/*
* @Author: obsidian
* @Date:   2016-03-10 10:17:33
* @Last Modified by:   obsidian
* @Last Modified time: 2016-05-21 20:54:21
*/
#include "menu_gpspath.h"
#include "../lcd_global.h"
#include "../lcd.h"
#include "control/GPSpath/GPSpath.h"
#include "module/camera/camera.h"
#include "module/ledboard/ledboard.h"

//enter  exec input back
void  menu_gpspath_init(void *parg);
void  menu_ledboard_vl1(void *parg){ledboard.change_threshold(1);}
void  menu_ledboard_vl2(void *parg){ledboard.change_threshold(2);}
void  menu_ledboard_vl3(void *parg){ledboard.change_threshold(3);}
void  menu_ledboard_vl4(void *parg){ledboard.change_threshold(4);}

struct Item gpspath_i[MAX_ITEM_NUM] = 
{
    {.ctx = "pre",      .id = 1, .ctx_len = 3, .flag = FILE, .value_type = INTEGER, .p_value = (void *)&gpspath.pre,          .func_enter =   nop, input,nop,nop},
    {.ctx = "base_pre", .id = 2, .ctx_len = 8, .flag = FILE, .value_type = INTEGER, .p_value = (void *)&gpspath.base_pre,     .func_enter =   nop, input,nop,nop},
    {.ctx = "cmr_y",    .id = 3, .ctx_len = 5, .flag = FILE, .value_type = FLOAT, .p_value = (void *)&gpspath.camera_y,       .func_enter = nop, input,nop,nop},
    {.ctx = "st_idx",   .id = 4, .ctx_len = 7, .flag = FILE, .value_type = INTEGER, .p_value = (void *)&gpspath.start_idx,    .func_enter =   nop, input,nop,nop},
    {.ctx = "led_sts",   .id = 5, .ctx_len = 7, .flag = FILE, .value_type = INTEGER, .p_value = (void *)&ledboard.status,    .func_enter =   nop, input,nop,nop},
    {.ctx = "led_vl1",   .id = 6, .ctx_len = 7, .flag = FILE, .value_type = NONE, .p_value = (void *)&ledboard.status,    .func_enter =   nop, menu_ledboard_vl1,nop,nop},
    {.ctx = "led_vl2",   .id = 7, .ctx_len = 7, .flag = FILE, .value_type = NONE, .p_value = (void *)&ledboard.status,    .func_enter =   nop, menu_ledboard_vl2,nop,nop},
    {.ctx = "led_vl3",   .id = 8, .ctx_len = 7, .flag = FILE, .value_type = NONE, .p_value = (void *)&ledboard.status,    .func_enter =   nop, menu_ledboard_vl3,nop,nop},
    {.ctx = "led_vl4",   .id = 9, .ctx_len = 7, .flag = FILE, .value_type = NONE, .p_value = (void *)&ledboard.status,    .func_enter =   nop, menu_ledboard_vl4,nop,nop},

};

struct Node gpspath_n = 
{
    // .itemnum            =   sizeof(gpspath_i) / sizeof(gpspath_i[0]),
    // .page_num           =   sizeof(gpspath_i) / sizeof(gpspath_i[0]) / PAGE_SIZE,
    .page_index         =   0,  
    .node_id            =   6,  
    .p_item             =   gpspath_i,
    .position           =   {0, 0},
    .parent             =   &control_n,
    .child              =   {0},
    .init               =   menu_gpspath_init,
};
void  menu_gpspath_init(void *parg)
{
    unsigned char i = 0;
    for(i = 0;i < MAX_ITEM_NUM;i ++)
    {
        if(gpspath_i[i].ctx[0] == 0){break;}
        gpspath_n.itemnum ++;
    }
    gpspath_n.page_num = gpspath_n.itemnum / PAGE_SIZE;

    gpspath_n.save = gpspath.save;
}
